home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fatted Calf
/
The Fatted Calf.iso
/
Applications
/
Astronomy
/
Moon
/
Source
/
MoonIconView.m
< prev
next >
Wrap
Text File
|
1993-01-19
|
1KB
|
55 lines
/* MoonIconView.m
* Part of the Moon application for the NeXT computer.
* Author: Geoffrey S. Knauth
* Date: January 4, 1992
*
* Permission to copy this program is hereby granted under the terms
* of the Free Software Foundation's GNU General Public License.
*/
#import <dpsclient/psops.h> /* PSsetgray */
#import "MoonIconView.h"
#import "all.h"
@implementation MoonIconView
- initFrame :(const NXRect *)frameRect
{
[super initFrame:frameRect];
[self setOpaque:YES];
return self;
}
- drawSelf :(const NXRect *)rects :(int)rectCount
{
NXPoint center = {NX_WIDTH(&bounds)/2., NX_HEIGHT(&bounds)/2.};
float yradius = NX_HEIGHT(&bounds)/2.-2.;
float xradius = yradius;
PSsetgray(NX_LTGRAY);
NXRectFill(&bounds);
/* draw the image of the moon */
PSsetgray(NX_WHITE);
PSarc(center.x, center.y, yradius, 0., 360.);
PSfill();
/* now draw the shadow over that part hidden from the sun */
DrawMoonShadow([self phase], ¢er, xradius, yradius, NX_BLACK);
return self;
}
- (float) phase
{
return phase;
}
- setPhase :(float) val
{
phase = val;
return self;
}
@end